<template>
	<Layout class="p-5 bg-white">
		<Form class="p-5" :model="house" :label-width="80">
			<FormItem class="w-50" label="标题">
				<Input v-model="house.title" />
			</FormItem>
			<FormItem class="w-50" label="详细描述">
				<Input v-model="house.detail" />
			</FormItem>
			<FormItem class="w-50" label="联系人">
				<Input v-model="house.personName" />
			</FormItem>
			<FormItem class="w-50" label="电话">
				<Input v-model="house.tel" />
			</FormItem>
			<FormItem class="w-50" label="微信">
				<Input v-model="house.wxNumber" />
			</FormItem>
			</Col>
			<FormItem class="text-right">
				<Button @click="submit" type="primary">提交</Button>
				<Button @click="cancel" class="ml-2">取消</Button>
			</FormItem>
		</Form>
	</Layout>
</template>
<script>
	export default {
		data() {
			return {
				house: {
					houseBuyId: 0,
					title: "",
					detail: "",
					ct: "",
					ut: "",
					deleteFlag: "",
					delFlg: "",
					clintId: "",
					personName : "",
					tel : "",
					wxNumber:'',
				}
			}
		},
		methods: {
			cancel: function() {
				this.$tabs.close();
			},
			submit: function() {
				let self = this;
				let houses = [];
				for (let index in this.$data.houses) {
					let houseItem = this.$data.house[index];
					houses.push(houseItem.houseBuyId);
				}
				self.house.houses = JSON.stringify(houses);
				this.http.put({
					url: "/house-buy-info/info",
					param: self.house,
				}).then(() => {
					self.message.info("修改成功");
					self.$tabs.close();
					this.$router.push({
						name: "houseBuy"
					})
				});
			},
			init: function() {
				let self = this;
				this.http.get({
					url: "/house-buy-client-vo/info",
					param: {
						houseBuyId: this.$data.house.houseBuyId
					}
				}).then(data => {
					self.$data.house = data;
				});
			},
		},
		created: function() {
			this.$data.house.houseBuyId = this.$route.params.houseBuyId;
			this.init();
		},
	}
</script>

<style>
</style>
